//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.yang.newcustomcuilian.newapi;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import com.yang.newcustomcuilian.NewCustomCuiLian;
import com.yang.newcustomcuilian.language.Language;
import com.yang.newcustomcuilian.level.Level;
import com.yang.newcustomcuilian.stone.Stone;
import com.yang.newcustomcuilian.variable.Variable;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.attribute.Attribute;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.Plugin;

public class NewAPI {
    Plugin plugin;

    public NewAPI(Plugin p) {
        this.plugin = p;
    }

    public static Level getMinLevel(List<ItemStack> list) {
        if (list.size() < 4 && (NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.8") || NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.7"))) {
            return NewCustomCuiLian.customCuilianManager.NULLLevel;
        } else if (list.size() < 5 && NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.9+")) {
            return NewCustomCuiLian.customCuilianManager.NULLLevel;
        } else {
            boolean flag = true;
            Level ret = NewCustomCuiLian.customCuilianManager.NULLLevel;
            Iterator var3 = list.iterator();

            while(var3.hasNext()) {
                ItemStack item = (ItemStack)var3.next();
                Level l = getLevelByItem(item);
                if (l.levelValue == -1) {
                    return NewCustomCuiLian.customCuilianManager.NULLLevel;
                }

                if (flag) {
                    ret = l;
                    flag = false;
                } else if (l.levelValue < ret.levelValue) {
                    ret = l;
                }
            }

            return ret;
        }
    }

    public static LivingEntity getLivingEntityByEntityId(UUID id) {
        Iterator<World> iterator = Bukkit.getWorlds().iterator();
        if (!iterator.hasNext()) {
            return null;
        } else {
            World w = (World)iterator.next();
            Iterator it = w.getLivingEntities().iterator();

            LivingEntity e;
            do {
                while(!it.hasNext()) {
                }

                e = (LivingEntity)it.next();
            } while(!e.getUniqueId().equals(id));

            return e;
        }
    }

    public static String getFileVersion() {
        return NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.9+") ? "-1_9" : "-1_8";
    }

    public static ItemStack getItemInHand(LivingEntity p) {
        if (NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.9+") && p.getEquipment() != null && p.getEquipment().getItemInHand() != null) {
            return p.getEquipment().getItemInMainHand();
        } else {
            return p.getType() == EntityType.PLAYER && p.getEquipment() != null ? ((Player)p).getItemInHand() : p.getEquipment().getItemInHand();
        }
    }

    public static ItemStack getItemInOffHand(LivingEntity p) {
        return NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.9+") ? p.getEquipment().getItemInOffHand() : new ItemStack(Material.AIR);
    }

    public static void setItemInHand(Player p, ItemStack i) {
        if (NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.9+")) {
            p.getInventory().setItemInMainHand(i);
        } else {
            p.getInventory().setItemInHand(i);
        }

    }

    public static double getMaxHealth(LivingEntity p) {
        return NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.9+") ? p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() : p.getMaxHealth();
    }

    public static void setMaxHealth(LivingEntity p, double m) {
        if (NewCustomCuiLian.ServerVersion.equalsIgnoreCase("1.9+")) {
            p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(m);
        } else {
            p.setMaxHealth(m);
        }

    }

    public static Level getLevelByQuenchingProtectRune(ItemStack i) {
        if (i != null && i.hasItemMeta() && i.getItemMeta().hasLore()) {
            Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();

            while(var1.hasNext()) {
                Level Key = (Level)var1.next();
                if (Key.quenchingProtectRune != null && Key.quenchingProtectRune.getItemMeta().equals(i.getItemMeta())) {
                    return Key;
                }
            }
        }

        return NewCustomCuiLian.customCuilianManager.NULLLevel;
    }

    public static ItemStack cuilian(ItemStack cls, ItemStack item, Player p) {
        if (cls != null && item != null && p != null && NewCustomCuiLian.customCuilianManager.ItemList.contains(item.getType())) {
            Level level = getLevelByItem(item);
            Stone stone = getStoneByItem(cls);
            int dx = getRandom((Integer)stone.dropLevel.get(0), (Integer)stone.dropLevel.get(1));
            int sx = stone.riseLevel;
            String sendMessage;
            if ((double)getRandom(0, 100) <= (Double)stone.levelProbability.get(getLevelByInteger(level.levelValue + sx))) {
                item = setItemCuiLian(item, getLevelByInteger(level.levelValue + sx), p);
                sendMessage = Language.CAN_CUILIAN_PROMPT.replace("%s", (CharSequence)((Level)NewCustomCuiLian.customCuilianManager.customCuilianLevelList.get(level.levelValue + sx)).levelString.get(0));
                if (level.levelValue + sx >= 5) {
                    Bukkit.broadcastMessage(Language.ALL_SERVER_PROMPT.replace("%p", p.getDisplayName()).replace("%d", cls.getItemMeta().getDisplayName()).replace("%s", (CharSequence)((Level)NewCustomCuiLian.customCuilianManager.customCuilianLevelList.get(level.levelValue + sx)).levelString.get(0)));
                }
            } else if (getLevelByQuenchingProtectRuneString(item).levelValue <= level.levelValue && getLevelByQuenchingProtectRuneString(item) != NewCustomCuiLian.customCuilianManager.NULLLevel && level.levelValue - getLevelByQuenchingProtectRuneString(item).levelValue < (Integer)stone.dropLevel.get(1)) {
                int dx2 = getRandom(0, level.levelValue - getLevelByQuenchingProtectRuneString(item).levelValue);
                item = setItemCuiLian(item, getLevelByInteger(level.levelValue - dx2), p);
                sendMessage = Language.HAS_BAOHUFU_CUILIAN_OVER.replace("%s", (CharSequence)getLevelByInteger(level.levelValue - dx2).levelString.get(0)).replace("%d", String.valueOf(dx2));
            } else if (level.levelValue - dx >= 0) {
                item = setItemCuiLian(item, getLevelByInteger(level.levelValue - dx), p);
                sendMessage = Language.CUILIAN_OVER.replace("%s", (CharSequence)getLevelByInteger(level.levelValue - dx).levelString.get(0)).replace("%d", String.valueOf(dx));
            } else {
                item = setItemCuiLian(item, NewCustomCuiLian.customCuilianManager.NULLLevel, p);
                sendMessage = Language.CUILIAN_OVER_ZERO.replace("%d", String.valueOf(dx));
            }

            p.sendMessage(sendMessage);
        }

        return item;
    }

    public static ItemStack setItemCuiLian(ItemStack item, Level level, Player p) {
        Object lore4;
        List lore5;
        if (NewCustomCuiLian.customCuilianManager.ItemList.contains(item.getType()) && level != NewCustomCuiLian.customCuilianManager.NULLLevel) {
            lore4 = new ArrayList();
            if (item.getItemMeta().hasLore()) {
                lore4 = item.getItemMeta().getLore();
            }

            lore5 = cleanCuiLian((List)lore4);
            lore5.addAll(Language.UNDER_LINE);
            lore5.addAll(level.levelString);
            lore5.addAll(getLore((List)Objects.requireNonNull(getListStringByType(item.getType())), level, item.getType()));
            if (lore5.isEmpty()) {
                lore5.add("");
            }

            List<String> lore3 = cleanQuenchingProtectRune(lore5);
            ItemMeta meta = item.getItemMeta();
            meta.setLore(lore3);
            item.setItemMeta(meta);
        } else if (level == NewCustomCuiLian.customCuilianManager.NULLLevel) {
            lore4 = new ArrayList();
            if (item.getItemMeta().hasLore()) {
                lore4 = item.getItemMeta().getLore();
            }

            lore5 = cleanQuenchingProtectRune(cleanCuiLian((List)lore4));
            ItemMeta meta2 = item.getItemMeta();
            meta2.setLore(lore5);
            item.setItemMeta(meta2);
        }

        return item;
    }

    public static List<String> cleanCuiLian(List<String> lore) {
        if (lore != null) {
            for(int i = 0; i < lore.size() && i >= 0; ++i) {
                if (((String)lore.get(i)).contains("装备淬炼")) {
                    lore.remove(i);
                    --i;
                }
            }

            if (lore.containsAll(Language.UNDER_LINE)) {
                lore.removeAll(Language.UNDER_LINE);
            }

            Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();
            while(var1.hasNext()) {
                Level Key = (Level)var1.next();
                if (lore.containsAll(Key.levelString)) {
                    lore.removeAll(Key.levelString);
                }
            }

            for(int j = 0; j < lore.size() && j >= 0; ++j) {
                if (((String)lore.get(j)).contains(Language.FIRST)) {
                    lore.remove(j);
                    --j;
                }
            }
        }

        return lore;
    }
    
   public static List<String> cleanCuiLian01(List<String> lore) {
        if (lore != null) {
            if (lore.containsAll(Language.UNDER_LINE)) {
                lore.removeAll(Language.UNDER_LINE);
            }

            Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();

            while(var1.hasNext()) {
                Level Key = (Level)var1.next();
                if (lore.containsAll(Key.levelString)) {
                    lore.removeAll(Key.levelString);
                }
            }

            for(int j = 0; j < lore.size() && j >= 0; ++j) {
                if (((String)lore.get(j)).contains(Language.FIRST)) {
                    lore.remove(j);
                    --j;
                }
            }
        }

        return lore;
    }

    public static List<String> cleanQuenchingProtectRune(List<String> lore) {
        if (lore != null && !lore.isEmpty()) {
            for(int j = 0; j < lore.size() && j >= 0; ++j) {
                Iterator var2 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();

                while(var2.hasNext()) {
                    Level l = (Level)var2.next();
                    if (l.hasQuenchingProtectRune && j >= 0 && l.quenchingProtectRuneString.equalsIgnoreCase((String)lore.get(j)) && l.levelValue > getLevelByLoreList(lore).levelValue) {
                        lore.remove(j);
                        --j;
                    }
                }
            }
        }

        return lore;
    }

    public static int getRandom(int min, int max) {
        return min == max ? 0 : (int)(Math.random() * (double)(max - min + 1)) + min;
    }

    public static Stone getStoneByItem(ItemStack i) {
        if (i != null && i.hasItemMeta() && i.getItemMeta().hasLore()) {
            Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianStoneList.iterator();

            while(var1.hasNext()) {
                Stone Key = (Stone)var1.next();
                if (Key.cuiLianStone.getItemMeta().equals(i.getItemMeta())) {
                    return Key;
                }
            }
        }

        return NewCustomCuiLian.customCuilianManager.NULLStone;
    }

    public static Level getLevelByQuenchingProtectRuneString(ItemStack i) {
        Level l = NewCustomCuiLian.customCuilianManager.NULLLevel;
        if (i != null && i.hasItemMeta() && i.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(i.getType())) {
            Object lore;
            if (i.getItemMeta().hasLore()) {
                lore = i.getItemMeta().getLore();
            } else {
                lore = new ArrayList();
            }

            Iterator var3 = ((List)lore).iterator();

            while(var3.hasNext()) {
                String line = (String)var3.next();
                Iterator var5 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();

                while(var5.hasNext()) {
                    Level Key = (Level)var5.next();
                    if (Key.quenchingProtectRuneString.equals(line) && Key.levelValue >= l.levelValue) {
                        l = Key;
                    }
                }
            }
        }

        return l;
    }

    public static List<String> getListStringByType(Material itemid) {
        if (NewCustomCuiLian.arms.contains(itemid)) {
            return NewCustomCuiLian.powerArms;
        } else if (NewCustomCuiLian.boots.contains(itemid)) {
            return NewCustomCuiLian.powerBoots;
        } else if (NewCustomCuiLian.chestplate.contains(itemid)) {
            return NewCustomCuiLian.powerChestplate;
        } else if (NewCustomCuiLian.leggings.contains(itemid)) {
            return NewCustomCuiLian.powerLeggings;
        } else {
            return NewCustomCuiLian.helmet.contains(itemid) ? NewCustomCuiLian.powerHelmet : null;
        }
    }

    public static String getType(Material itemid) {
        if (NewCustomCuiLian.arms.contains(itemid)) {
            return "arms";
        } else if (NewCustomCuiLian.boots.contains(itemid)) {
            return "boots";
        } else if (NewCustomCuiLian.chestplate.contains(itemid)) {
            return "chestplate";
        } else if (NewCustomCuiLian.leggings.contains(itemid)) {
            return "leggings";
        } else {
            return NewCustomCuiLian.helmet.contains(itemid) ? "helmet" : "";
        }
    }

    public static List<String> getCuiLianTypeForLocal(Material itemid) {
        if (NewCustomCuiLian.arms.contains(itemid)) {
            return NewCustomCuiLian.localArms;
        } else if (NewCustomCuiLian.boots.contains(itemid)) {
            return NewCustomCuiLian.localBoots;
        } else if (NewCustomCuiLian.chestplate.contains(itemid)) {
            return NewCustomCuiLian.localChestplate;
        } else if (NewCustomCuiLian.leggings.contains(itemid)) {
            return NewCustomCuiLian.localLeggings;
        } else {
            return NewCustomCuiLian.helmet.contains(itemid) ? NewCustomCuiLian.localHelmet : null;
        }
    }

    public static List<String> getLore(List<String> powerlist, Level level, Material itemid) {
        List<String> lore = new ArrayList();
        Iterator var4 = powerlist.iterator();

        label124:
        while(var4.hasNext()) {
            String str = (String)var4.next();
            Iterator var6;
            String s6;
            if (str.equalsIgnoreCase("damage")) {
                var6 = Language.DAMAGE_LORE.iterator();

                while(var6.hasNext()) {
                    s6 = (String)var6.next();
                    if ((Double)level.attribute.damage.get(getType(itemid)) != 0.0D) {
                        lore.add(Language.FIRST + s6.replace("%d", String.valueOf(level.attribute.damage.get(getType(itemid)))));
                    }
                }
            }

            if (str.equalsIgnoreCase("bloodSuck")) {
                var6 = Language.BLOOD_SUCKING_LORE.iterator();

                while(var6.hasNext()) {
                    s6 = (String)var6.next();
                    if ((Double)level.attribute.bloodSuck.get(getType(itemid)) != 0.0D) {
                        lore.add(Language.FIRST + s6.replace("%d", String.valueOf(level.attribute.bloodSuck.get(getType(itemid)))));
                    }
                }
            }

            if (str.equalsIgnoreCase("experience")) {
                var6 = Language.EXPRIENCE.iterator();

                while(var6.hasNext()) {
                    s6 = (String)var6.next();
                    if ((Double)level.attribute.experience.get(getType(itemid)) != 0.0D) {
                        lore.add(Language.FIRST + s6.replace("%d", String.valueOf(level.attribute.experience.get(getType(itemid)))));
                    }
                }
            }

            if (str.equalsIgnoreCase("defense")) {
                var6 = Language.DEFENSE_LORE.iterator();

                while(var6.hasNext()) {
                    s6 = (String)var6.next();
                    if ((Double)level.attribute.defense.get(getType(itemid)) != 0.0D) {
                        lore.add(Language.FIRST + s6.replace("%d", String.valueOf(level.attribute.defense.get(getType(itemid)))));
                    }
                }
            }

            if (str.equalsIgnoreCase("reboundDamage")) {
                var6 = Language.ANTI_INJURY_LORE.iterator();

                while(var6.hasNext()) {
                    s6 = (String)var6.next();
                    if ((Double)level.attribute.reboundDamage.get(getType(itemid)) != 0.0D) {
                        lore.add(Language.FIRST + s6.replace("%d", String.valueOf(level.attribute.reboundDamage.get(getType(itemid)))));
                    }
                }
            }

            if (str.equalsIgnoreCase("jump")) {
                var6 = Language.JUMP_LORE.iterator();

                while(var6.hasNext()) {
                    s6 = (String)var6.next();
                    if ((Double)level.attribute.jump.get(getType(itemid)) != 0.0D) {
                        lore.add(Language.FIRST + s6.replace("%d", String.valueOf(level.attribute.jump.get(getType(itemid)))));
                    }
                }
            }

            var6 = NewCustomCuiLian.variables.iterator();

            while(true) {
                Variable v;
                do {
                    if (!var6.hasNext()) {
                        continue label124;
                    }

                    v = (Variable)var6.next();
                } while(!str.equalsIgnoreCase(v.name));

                Iterator var8 = v.lore.iterator();

                while(var8.hasNext()) {
                    String s7 = (String)var8.next();
                    if ((Double)((HashMap)level.attribute.list.get(NewCustomCuiLian.variables.indexOf(v))).get(getType(itemid)) != 0.0D) {
                        lore.add(Language.FIRST + s7.replace("%d", String.valueOf(((HashMap)level.attribute.list.get(NewCustomCuiLian.variables.indexOf(v))).get(getType(itemid)))));
                    }
                }
            }
        }

        return lore;
    }

    public static ItemStack addCuilianQuenchingProtectRune(ItemStack i, ItemStack quenchingProtectRune) {
        if (i != null && quenchingProtectRune != null && i.hasItemMeta() && quenchingProtectRune.hasItemMeta() && i.getItemMeta().hasLore() && quenchingProtectRune.getItemMeta().hasLore() && getLevelByQuenchingProtectRune(quenchingProtectRune) != NewCustomCuiLian.customCuilianManager.NULLLevel) {
            ItemMeta meta = i.getItemMeta();
            List<String> lore = new ArrayList();
            if (meta.hasLore()) {
                lore.addAll(meta.getLore());
            }

            List<String> lore2 = cleanQuenchingProtectRune(i.getItemMeta().getLore());
            lore2.add(getLevelByQuenchingProtectRune(quenchingProtectRune).quenchingProtectRuneString);
            meta.setLore(lore2);
            i.setItemMeta(meta);
        }

        return i;
    }

    public static Double getExperience(List<ItemStack> itemlist) {
        Double value = 0.0D;
        Iterator var2 = itemlist.iterator();

        while(var2.hasNext()) {
            ItemStack item = (ItemStack)var2.next();
            if (item != null && item.hasItemMeta() && item.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(item.getType()) && getLevelByItem(item) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getListStringByType(item.getType()))).contains("experience")) {
                value = value + (Double)getLevelByItem(item).attribute.experience.get(getType(item.getType()));
            }
        }

        return value;
    }

    public static int getJump(List<ItemStack> itemlist) {
        int value = 0;
        Iterator var2 = itemlist.iterator();

        while(var2.hasNext()) {
            ItemStack item = (ItemStack)var2.next();
            if (item != null && item.hasItemMeta() && item.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(item.getType()) && getLevelByItem(item) != NewCustomCuiLian.customCuilianManager.NULLLevel && getListStringByType(item.getType()).contains("jump")) {
                value = (int)((double)value + (Double)getLevelByItem(item).attribute.jump.get(getType(item.getType())));
            }
        }

        return value;
    }

    public static Double getDamage(List<ItemStack> itemlist) {
        Double value = 0.0D;
        Iterator var2 = itemlist.iterator();

        while(var2.hasNext()) {
            ItemStack item = (ItemStack)var2.next();
            if (item != null && item.hasItemMeta() && item.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(item.getType()) && getLevelByItem(item) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getListStringByType(item.getType()))).contains("damage")) {
                value = value + (Double)getLevelByItem(item).attribute.damage.get(getType(item.getType()));
            }
        }

        return value;
    }

    public static Double getBloodSuck(List<ItemStack> itemlist) {
        Double value = 0.0D;
        Iterator var2 = itemlist.iterator();

        while(var2.hasNext()) {
            ItemStack item = (ItemStack)var2.next();
            if (item != null && item.hasItemMeta() && item.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(item.getType()) && getLevelByItem(item) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getListStringByType(item.getType()))).contains("bloodSuck")) {
                value = value + (Double)getLevelByItem(item).attribute.bloodSuck.get(getType(item.getType()));
            }
        }

        return value;
    }

    public static Double getDefense(List<ItemStack> itemlist) {
        Double value = 0.0D;
        Iterator var2 = itemlist.iterator();

        while(var2.hasNext()) {
            ItemStack item = (ItemStack)var2.next();
            if (item != null && item.hasItemMeta() && item.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(item.getType()) && getLevelByItem(item) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getListStringByType(item.getType()))).contains("defense")) {
                value = value + (Double)getLevelByItem(item).attribute.defense.get(getType(item.getType()));
            }
        }

        return value;
    }

    public static Double getReboundDamage(List<ItemStack> itemlist) {
        Double value = 0.0D;
        Iterator var2 = itemlist.iterator();

        while(var2.hasNext()) {
            ItemStack item = (ItemStack)var2.next();
            if (item != null && item.hasItemMeta() && item.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(item.getType()) && getLevelByItem(item) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getListStringByType(item.getType()))).contains("reboundDamage")) {
                value = value + (Double)getLevelByItem(item).attribute.reboundDamage.get(getType(item.getType()));
            }
        }

        return value;
    }

    public static List<ItemStack> addAll(ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4, ItemStack i5, ItemStack i6) {
        List<ItemStack> item = new ArrayList();
        if (i1 != null && i1.hasItemMeta() && i1.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(i1.getType()) && getLevelByItem(i1) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getCuiLianTypeForLocal(i1.getType()))).contains("hand")) {
            item.add(i1);
        }

        if (i2 != null && i2.hasItemMeta() && i2.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(i2.getType()) && getLevelByItem(i2) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getCuiLianTypeForLocal(i2.getType()))).contains("bag")) {
            item.add(i2);
        }

        if (i3 != null && i3.hasItemMeta() && i3.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(i3.getType()) && getLevelByItem(i3) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getCuiLianTypeForLocal(i3.getType()))).contains("bag")) {
            item.add(i3);
        }

        if (i4 != null && i4.hasItemMeta() && i4.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(i4.getType()) && getLevelByItem(i4) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getCuiLianTypeForLocal(i4.getType()))).contains("bag")) {
            item.add(i4);
        }

        if (i5 != null && i5.hasItemMeta() && i5.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(i5.getType()) && getLevelByItem(i5) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getCuiLianTypeForLocal(i5.getType()))).contains("bag")) {
            item.add(i5);
        }

        if (i6 != null && i6.hasItemMeta() && i6.getItemMeta().hasLore() && NewCustomCuiLian.customCuilianManager.ItemList.contains(i6.getType()) && getLevelByItem(i6) != NewCustomCuiLian.customCuilianManager.NULLLevel && ((List)Objects.requireNonNull(getCuiLianTypeForLocal(i6.getType()))).contains("hand")) {
            item.add(i6);
        }

        return item;
    }

    public static Level getLevelByString(List<String> s) {
        Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();

        Level l;
        do {
            if (!var1.hasNext()) {
                return NewCustomCuiLian.customCuilianManager.NULLLevel;
            }

            l = (Level)var1.next();
        } while(!l.levelString.equals(s));

        return l;
    }

    public static Level getLevelByItem(ItemStack i) {
        if (i != null && i.hasItemMeta() && i.getItemMeta().hasLore()) {
            Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();

            while(var1.hasNext()) {
                Level Key = (Level)var1.next();
                if (i.getItemMeta().getLore().containsAll(Key.levelString)) {
                    return Key;
                }
            }
        }

        return NewCustomCuiLian.customCuilianManager.NULLLevel;
    }

    public static Level getLevelByLoreList(List<String> lore) {
        if (lore != null && !lore.isEmpty()) {
            Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();

            while(var1.hasNext()) {
                Level Key = (Level)var1.next();
                if (lore.containsAll(Key.levelString)) {
                    return Key;
                }
            }
        }

        return NewCustomCuiLian.customCuilianManager.NULLLevel;
    }

    public static Level getLevelByInteger(int s) {
        return s > -1 && s <= NewCustomCuiLian.Max ? (Level)NewCustomCuiLian.customCuilianManager.customCuilianLevelList.get(s) : NewCustomCuiLian.customCuilianManager.NULLLevel;
    }

    public static boolean isStoneMapItemMetaHasItemMeta(ItemMeta meta) {
        if (meta != null) {
            Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianStoneList.iterator();

            while(var1.hasNext()) {
                Stone s = (Stone)var1.next();
                if (s.cuiLianStone.hasItemMeta() && s.cuiLianStone.getItemMeta().equals(meta)) {
                    return true;
                }
            }
        }

        return false;
    }

    public static boolean isQuenchingProtectRuneMapItemMetaHasItemMeta(ItemMeta meta) {
        if (meta != null) {
            Iterator var1 = NewCustomCuiLian.customCuilianManager.customCuilianLevelList.iterator();

            while(var1.hasNext()) {
                Level s = (Level)var1.next();
                if (s.quenchingProtectRune != null && s.quenchingProtectRune.hasItemMeta() && s.quenchingProtectRune.getItemMeta().equals(meta)) {
                    return true;
                }
            }
        }

        return false;
    }

    public static HashMap getHashMap(String s1, YamlConfiguration config, int i, String s2) {
        HashMap<String, Double> hashmap = new HashMap();
        if (config.get(i + "." + s1 + "." + s2) != null) {
            hashmap.put(s1, config.getDouble(i + "." + s1 + "." + s2));
        } else {
            hashmap.put(s1, 0.0D);
        }

        return hashmap;
    }
}
